blob: 15f601070d2eac861eec800efc39ea29769f64b3 [file] [log] [blame]
Junio C Hamanodfccbb02008-05-26 01:16:141<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamanodfccbb02008-05-26 01:16:147<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamanodfccbb02008-05-26 01:16:1426
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamanodfccbb02008-05-26 01:16:1448 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamanodfccbb02008-05-26 01:16:1451 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamanodfccbb02008-05-26 01:16:1459
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamanodfccbb02008-05-26 01:16:1484}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamanodfccbb02008-05-26 01:16:14155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamanodfccbb02008-05-26 01:16:14166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamanodfccbb02008-05-26 01:16:14171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamanodfccbb02008-05-26 01:16:14215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamanodfccbb02008-05-26 01:16:14220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamanodfccbb02008-05-26 01:16:14236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamanodfccbb02008-05-26 01:16:14275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamanodfccbb02008-05-26 01:16:14306</style>
307<title>gitcvs-migration(7)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312gitcvs-migration(7) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>gitcvs-migration -
317 git for CVS users
318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31323<div class="para"><p>git cvsimport *</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14324</div>
Junio C Hamanoba4b9282008-07-06 05:20:31325<h2 id="_description">DESCRIPTION</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14326<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31327<div class="para"><p>Git differs from CVS in that every working tree contains a repository with
Junio C Hamanodfccbb02008-05-26 01:16:14328a full copy of the project history, and no repository is inherently more
329important than any other. However, you can emulate the CVS model by
330designating a single shared repository which people can synchronize with;
Junio C Hamanoba4b9282008-07-06 05:20:31331this document explains how to do that.</p></div>
332<div class="para"><p>Some basic familiarity with git is required. Having gone through
Junio C Hamanofce7c7e2008-07-02 03:06:38333<a href="gittutorial.html">gittutorial(7)</a> and
Junio C Hamanoba4b9282008-07-06 05:20:31334<a href="gitglossary.html">gitglossary(7)</a> should be sufficient.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14335</div>
Junio C Hamanoba4b9282008-07-06 05:20:31336<h2 id="_developing_against_a_shared_repository">Developing against a shared repository</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14337<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31338<div class="para"><p>Suppose a shared repository is set up in /pub/repo.git on the host
Junio C Hamanodfccbb02008-05-26 01:16:14339foo.com. Then as an individual committer you can clone the shared
Junio C Hamanoba4b9282008-07-06 05:20:31340repository over ssh with:</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14341<div class="listingblock">
342<div class="content">
343<pre><tt>$ git clone foo.com:/pub/repo.git/ my-project
344$ cd my-project</tt></pre>
345</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31346<div class="para"><p>and hack away. The equivalent of <em>cvs update</em> is</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14347<div class="listingblock">
348<div class="content">
349<pre><tt>$ git pull origin</tt></pre>
350</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31351<div class="para"><p>which merges in any work that others might have done since the clone
Junio C Hamanodfccbb02008-05-26 01:16:14352operation. If there are uncommitted changes in your working tree, commit
Junio C Hamanoba4b9282008-07-06 05:20:31353them first before running git pull.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14354<div class="admonitionblock">
355<table><tr>
356<td class="icon">
357<div class="title">Note</div>
358</td>
359<td class="content">
Junio C Hamanoba4b9282008-07-06 05:20:31360<div class="para"><p>The <em>pull</em> command knows where to get updates from because of certain
Junio C Hamano1aa40d22010-01-21 17:46:43361configuration variables that were set by the first <em>git clone</em>
Junio C Hamanodfccbb02008-05-26 01:16:14362command; see <tt>git config -l</tt> and the <a href="git-config.html">git-config(1)</a> man
Junio C Hamanoba4b9282008-07-06 05:20:31363page for details.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14364</td>
365</tr></table>
366</div>
Junio C Hamanoba4b9282008-07-06 05:20:31367<div class="para"><p>You can update the shared repository with your changes by first committing
Junio C Hamano1aa40d22010-01-21 17:46:43368your changes, and then using the <em>git push</em> command:</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14369<div class="listingblock">
370<div class="content">
371<pre><tt>$ git push origin master</tt></pre>
372</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31373<div class="para"><p>to "push" those commits to the shared repository. If someone else has
Junio C Hamano1aa40d22010-01-21 17:46:43374updated the repository more recently, <em>git push</em>, like <em>cvs commit</em>, will
Junio C Hamanodfccbb02008-05-26 01:16:14375complain, in which case you must pull any changes before attempting the
Junio C Hamanoba4b9282008-07-06 05:20:31376push again.</p></div>
Junio C Hamano1aa40d22010-01-21 17:46:43377<div class="para"><p>In the <em>git push</em> command above we specify the name of the remote branch
378to update (<tt>master</tt>). If we leave that out, <em>git push</em> tries to update
Junio C Hamanodfccbb02008-05-26 01:16:14379any branches in the remote repository that have the same name as a branch
Junio C Hamanoba4b9282008-07-06 05:20:31380in the local repository. So the last <em>push</em> can be done with either of:</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14381<div class="listingblock">
382<div class="content">
383<pre><tt>$ git push origin
384$ git push foo.com:/pub/project.git/</tt></pre>
385</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31386<div class="para"><p>as long as the shared repository does not have any branches
387other than <tt>master</tt>.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14388</div>
Junio C Hamanoba4b9282008-07-06 05:20:31389<h2 id="_setting_up_a_shared_repository">Setting Up a Shared Repository</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14390<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31391<div class="para"><p>We assume you have already created a git repository for your project,
Junio C Hamanofce7c7e2008-07-02 03:06:38392possibly created from scratch or from a tarball (see
393<a href="gittutorial.html">gittutorial(7)</a>), or imported from an already existing CVS
Junio C Hamanoba4b9282008-07-06 05:20:31394repository (see the next section).</p></div>
395<div class="para"><p>Assume your existing repo is at /home/alice/myproject. Create a new "bare"
Junio C Hamanodfccbb02008-05-26 01:16:14396repository (a repository without a working tree) and fetch your project into
Junio C Hamanoba4b9282008-07-06 05:20:31397it:</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14398<div class="listingblock">
399<div class="content">
400<pre><tt>$ mkdir /pub/my-repo.git
401$ cd /pub/my-repo.git
402$ git --bare init --shared
403$ git --bare fetch /home/alice/myproject master:master</tt></pre>
404</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31405<div class="para"><p>Next, give every team member read/write access to this repository. One
Junio C Hamanodfccbb02008-05-26 01:16:14406easy way to do this is to give all the team members ssh access to the
407machine where the repository is hosted. If you don't want to give them a
408full shell on the machine, there is a restricted shell which only allows
Junio C Hamanoba4b9282008-07-06 05:20:31409users to do git pushes and pulls; see <a href="git-shell.html">git-shell(1)</a>.</p></div>
410<div class="para"><p>Put all the committers in the same group, and make the repository
411writable by that group:</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14412<div class="listingblock">
413<div class="content">
414<pre><tt>$ chgrp -R $group /pub/my-repo.git</tt></pre>
415</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31416<div class="para"><p>Make sure committers have a umask of at most 027, so that the directories
417they create are writable and searchable by other group members.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14418</div>
Junio C Hamanoba4b9282008-07-06 05:20:31419<h2 id="_importing_a_cvs_archive">Importing a CVS archive</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14420<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31421<div class="para"><p>First, install version 2.1 or higher of cvsps from
Junio C Hamanodfccbb02008-05-26 01:16:14422<a href="http://www.cobite.com/cvsps/">http://www.cobite.com/cvsps/</a> and make
423sure it is in your path. Then cd to a checked out CVS working directory
Junio C Hamanoea868332009-04-21 08:11:06424of the project you are interested in and run <a href="git-cvsimport.html">git-cvsimport(1)</a>:</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14425<div class="listingblock">
426<div class="content">
427<pre><tt>$ git cvsimport -C &lt;destination&gt; &lt;module&gt;</tt></pre>
428</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31429<div class="para"><p>This puts a git archive of the named CVS module in the directory
430&lt;destination&gt;, which will be created if necessary.</p></div>
431<div class="para"><p>The import checks out from CVS every revision of every file. Reportedly
Junio C Hamanodfccbb02008-05-26 01:16:14432cvsimport can average some twenty revisions per second, so for a
433medium-sized project this should not take more than a couple of minutes.
Junio C Hamanoba4b9282008-07-06 05:20:31434Larger projects or remote repositories may take longer.</p></div>
435<div class="para"><p>The main trunk is stored in the git branch named <tt>origin</tt>, and additional
Junio C Hamanodfccbb02008-05-26 01:16:14436CVS branches are stored in git branches with the same names. The most
437recent version of the main trunk is also left checked out on the <tt>master</tt>
Junio C Hamanoba4b9282008-07-06 05:20:31438branch, so you can start adding your own changes right away.</p></div>
439<div class="para"><p>The import is incremental, so if you call it again next month it will
Junio C Hamanodfccbb02008-05-26 01:16:14440fetch any CVS updates that have been made in the meantime. For this to
441work, you must not modify the imported branches; instead, create new
442branches for your own changes, and merge in the imported branches as
Junio C Hamanoba4b9282008-07-06 05:20:31443necessary.</p></div>
444<div class="para"><p>If you want a shared repository, you will need to make a bare clone
445of the imported directory, as described above. Then treat the imported
446directory as another development clone for purposes of merging
447incremental imports.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14448</div>
Junio C Hamanoba4b9282008-07-06 05:20:31449<h2 id="_advanced_shared_repository_management">Advanced Shared Repository Management</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14450<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31451<div class="para"><p>Git allows you to specify scripts called "hooks" to be run at certain
Junio C Hamanodfccbb02008-05-26 01:16:14452points. You can use these, for example, to send all commits to the shared
Junio C Hamanoba4b9282008-07-06 05:20:31453repository to a mailing list. See <a href="githooks.html">githooks(5)</a>.</p></div>
454<div class="para"><p>You can enforce finer grained permissions using update hooks. See
Junio C Hamanodfccbb02008-05-26 01:16:14455<a href="howto/update-hook-example.txt">Controlling access to branches using
Junio C Hamanoba4b9282008-07-06 05:20:31456update hooks</a>.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14457</div>
Junio C Hamanoba4b9282008-07-06 05:20:31458<h2 id="_providing_cvs_access_to_a_git_repository">Providing CVS Access to a git Repository</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14459<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31460<div class="para"><p>It is also possible to provide true CVS access to a git repository, so
Junio C Hamanodfccbb02008-05-26 01:16:14461that developers can still use CVS; see <a href="git-cvsserver.html">git-cvsserver(1)</a> for
Junio C Hamanoba4b9282008-07-06 05:20:31462details.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14463</div>
Junio C Hamanoba4b9282008-07-06 05:20:31464<h2 id="_alternative_development_models">Alternative Development Models</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14465<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31466<div class="para"><p>CVS users are accustomed to giving a group of developers commit access to
Junio C Hamanodfccbb02008-05-26 01:16:14467a common repository. As we've seen, this is also possible with git.
468However, the distributed nature of git allows other development models,
469and you may want to first consider whether one of them might be a better
Junio C Hamanoba4b9282008-07-06 05:20:31470fit for your project.</p></div>
471<div class="para"><p>For example, you can choose a single person to maintain the project's
Junio C Hamanodfccbb02008-05-26 01:16:14472primary public repository. Other developers then clone this repository
473and each work in their own clone. When they have a series of changes that
474they're happy with, they ask the maintainer to pull from the branch
475containing the changes. The maintainer reviews their changes and pulls
476them into the primary repository, which other developers pull from as
477necessary to stay coordinated. The Linux kernel and other projects use
Junio C Hamanoba4b9282008-07-06 05:20:31478variants of this model.</p></div>
479<div class="para"><p>With a small group, developers may just pull changes from each other's
480repositories without the need for a central maintainer.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14481</div>
Junio C Hamanoba4b9282008-07-06 05:20:31482<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14483<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31484<div class="para"><p><a href="gittutorial.html">gittutorial(7)</a>,
Junio C Hamano9e1793f2008-06-02 07:31:16485<a href="gittutorial-2.html">gittutorial-2(7)</a>,
486<a href="gitcore-tutorial.html">gitcore-tutorial(7)</a>,
487<a href="gitglossary.html">gitglossary(7)</a>,
Junio C Hamanodfccbb02008-05-26 01:16:14488<a href="everyday.html">Everyday Git</a>,
Junio C Hamanoba4b9282008-07-06 05:20:31489<a href="user-manual.html">The Git User's Manual</a></p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14490</div>
Junio C Hamanoba4b9282008-07-06 05:20:31491<h2 id="_git">GIT</h2>
Junio C Hamanodfccbb02008-05-26 01:16:14492<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31493<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite.</p></div>
Junio C Hamanodfccbb02008-05-26 01:16:14494</div>
495<div id="footer">
496<div id="footer-text">
Junio C Hamanoac752fa2010-09-19 00:01:00497Last updated 2010-09-18 23:57:05 UTC
Junio C Hamanodfccbb02008-05-26 01:16:14498</div>
499</div>
500</body>
501</html>